package 第四章作业.O407;

import java.util.Scanner;

public class Area1 {
    public static void main(String[] args){
        TriangleArea();
        SquareArea();
        RectangleArea();
    }

    public static void TriangleArea(){
        Scanner reader = new Scanner(System.in);
        System.out.println("请输入三角形的底：");
        double a = reader.nextInt();
        System.out.println("请输入三角形的高：");
        double b = reader.nextInt();
        System.out.println("三角形的面积为"+(a*b/2));
    }
    public static void SquareArea(){
        Scanner reader = new Scanner(System.in);
        System.out.println("请输入正方形的边长：");
        double a = reader.nextInt();
        System.out.println("正方形的面积为"+Math.pow(a,2));
    }
    public static void RectangleArea(){
        Scanner reader = new Scanner(System.in);
        System.out.println("请输入长方形的底：");
        double a = reader.nextInt();
        System.out.println("请输入长方形的高：");
        double b = reader.nextInt();
        System.out.println("长方形的面积为"+a*b);
    }
}
